<template>
  <div>
    <el-carousel indicator-position="outside" style="width: 100%">
      <el-carousel-item v-for="item in items" :key="item.id">
        <!-- <el-image :src="require('@/assets/img/' + item.src)"></el-image> -->
        <el-image :src="item.src"></el-image>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>
<script>
import { getListCarousel } from "@/api/carousel"; // 引入封装后的axios
export default {
  name: "Carousel",

  data() {
    return {
      //items: [{id:1,src:'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'},{id:2,src:'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'}]
      items: [],
      apiUrl: "",
    };
  },
  created() {
    //const url = store.get("API_URL");

    this.fetchList();
  },
  methods: {
    async fetchList() {
      const response = await getListCarousel();
      //console.log(response.data)
      this.items = response.data;
    },
  },
};
</script>
<style scoped></style>
